package com.jinyang.plugin002

import android.app.Activity
import android.content.res.AssetManager
import android.content.res.Resources
import android.os.Bundle
import java.io.File

/**
 * @Author: LiuJinYang
 * @CreateDate: 2021/12/14
 * @Description:
 */
open class PluginBaseActivity2 : Activity() {
    private var mResources: Resources? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val plugin002Path: String = File(filesDir.absolutePath, "plugin002.apk").absolutePath
        mResources =
            LoadUtils.loadResources(this, AssetManager::class.java.newInstance(), listOf( plugin002Path))
    }

    override fun getResources(): Resources? {
        return mResources ?: super.getResources()
    }

    override fun getAssets(): AssetManager {
        return mResources?.assets ?: super.getAssets()
    }
}